-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Log stage-{1,2} output to secondary consoles #42255
Conversation
Do this instead of parsing the kernel command line as the default console might not be the virtual console, e.g. on platforms using Device Tree can indicate a preferred serial console with the /chosen/stdout-path property. This matches what dracut and Debian's initramfs-tools is doing.
Currently, if you pass multiple consoles to the kernel (e.g. 'console=ttyS0 console=tty0') you only get kernel's output to the primary console (the one specified last) until the boot is finished and a getty is launched on the secondary consoles. Let's explicitly write all stage-1 and stage-2 output to the secondary consoles just as we additionally write them to kmsg.
#!/usr/bin/env nix-shell
#!nix-shell -p busybox -i ash --pure
# shellcheck shell=ash
list_consoles() {
# shellcheck disable=2046
for console in $(echo "tty1 ttyS0 not-kept"); do echo "$console" ; done | head -n-1
# ^ replace with cat /sys/class/tty/console/active
}
for c in $(list_consoles); do
echo "Logging to $c"
done This relies on word-splitting, why SC2046 was disabled (An earlier revision was using |
or even |
Another approaches that might be worth trying instead of implementing this in shell scripts:
The advantage of these would be that they hook |
(triage) @dezgeg If I read correctly, this is already working except it doesn't encompass the systemd output yet. If so, maybe it'd make sense to merge this first, and when you find time to come back to systemd's output, do this one? |
Are there any updates on this pull request, please? |
Thank you for your contributions.
|
This obsoletes NixOS#42255. bootlogd is both a console multiplexer, and console logger. This allows us to drop the fiddly redirecting we were doing in shell script, and ensures each console= parameters on the kernel command-line gets the stage-1 output. This also gives us *way earlier* stage-1 logging than before.
I marked this as stale due to inactivity. → More info |
Currently, if you pass multiple consoles to the kernel (e.g.
console=ttyS0 console=tty0
) you only get stage-1 and stage-2 output on the primary console (the last one specified on the command line). This change redirects them to the secondary consoles as well.systemd's output is still only on the primary console. Need to look into that next.